const redis = require('redis');

const client = redis.createClient(6379, '127.0.0.1');
client.on('error', (err) => {
    console.error(err);
});

client.set('foo', 'bar', redis.print);
client.get('foo', (err, val) => {
    if (err) {
        console.log(err);
        return;
    }

    console.log(`foo is ${val}`);
    client.quit();
});
